package com.net;

import java.net.InetAddress;
import java.net.NetworkInterface;
import java.util.Enumeration;

/**
 * Created by peak on 2015/12/30.
 */
public class URLtest1 {
    public static void main(String[] args) throws Exception {
       Enumeration<NetworkInterface> list = NetworkInterface.getNetworkInterfaces();
        while(list.hasMoreElements()){
            NetworkInterface item = list.nextElement();
            Enumeration<InetAddress> addresses = item.getInetAddresses();
            System.out.println(item.getName()+"---------");
            while(addresses.hasMoreElements()){
                System.out.println(addresses.nextElement().getHostAddress());
            }
            System.out.println("------------");
        }
    }
}
